package com.qf.utis;

import lombok.Data;
import org.springframework.stereotype.Component;

@Component
@Data
public class R {
    private Integer code;
    private String msg;
    private Object data;


    public static R ok(Object  data){
        R r = ok();
        r.setData(data);
        return r;
    }
    public static R ok(){
        R r = new R();
        r.setCode(200);
        r.setMsg("成功");
        return r;
    }
    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setMsg("失败");
        return r;
    }
    public static R error(String  msg){
        R r = error();
        r.setMsg( msg);
        return r;
    }
}
